
<template>
	<view class="content">
		<template v-if="orderlist != ''">
			<!-- #ifdef MP-WEIXIN -->
			<view style="width:100%;height:60rpx;">
				<image style="width: 50rpx; height:50rpx;float:right;margin-right:20rpx;padding-left: 3rpx;" @tap="shuoming"
					src="https://mh.qingfentool.vip/upload/image/20230325/c39263efc6e1fe5dc7ef28da0a4996aa.png"
					mode="scaleToFill" />
			</view>
			<!-- #endif -->
			<radio-group @change="radioChange">
				<view class="poa" v-for="(item, index) in orderlist" :key="index">
					<view class="yuan">
						<radio :value="item.order_id" />
					</view>
					<view class="big_box">
						<view class="img_box">
							<view class="dengji_box_tl">
								<image  
									:src="item.level_icon"
									mode="scaleToFill" />
							</view>
							<image :src="item.prize_icon" mode=""></image>
						</view>
						<view class="txt_box">
							<view class="top_txt">
								{{ item.prize_name }}
							</view>
							<view class="bot_txt">
								大王币：{{ item.price }}
								<text class="bot_right_txt">x{{ item.num }}</text>
							</view>
						</view>
					</view>
				</view>
			</radio-group>

		</template>
		<template v-else>
			<!-- #ifdef MP-WEIXIN -->
			<view style="width:100%;height:60rpx;">
				<image style="width: 50rpx; height:50rpx;float:right;margin-right:20rpx;padding-left: 3rpx;" @tap="shuoming"
					src="https://mh.qingfentool.vip/upload/image/20230325/c39263efc6e1fe5dc7ef28da0a4996aa.png"
					mode="scaleToFill" />
			</view>
			<!-- #endif -->
			<view class="emptya flex-column flex-c-c">
				<view class="" style="width: 518rpx;height: 412rpx;margin: auto;">
					<image style="width: 100%; height: 100%;"
						src="https://mh.qingfentool.vip/upload/image/20230529/a63d80de20efc83f80f591044ae9e5dc.png" mode="">
					</image>
					<view style="width: 100%;text-align: center; color: #666666;font-size: 28rpx;">暂无商品～快去抽取心动盲盒吧</view>
				</view>
			</view>
		</template>
		<view style="width: 100%; height: 110rpx;">
		</view>
		<view class="bottom_box">
			<view class="left_box">
				<view>
					共<text style="color:#FF9900;">{{ fhnum }}</text>件商品可选择重新抽取
				</view>
				<view>
					可选择1件
				</view>
			</view>
			<view class="right_box" @click="$u.throttle(submit, 1000)">
				确定重抽
			</view>
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			orderlist: [],
			page: 1,
			fhnum: '',
			orderidValue: '',
			tabindex: 1,
			page: 1,
			nums: '',
		}
	},
	onLoad() {
		this.$Router.replace({
			path: '/pages/index/cabinetBox'
		})
submit
	},
	onReachBottom() {
		if (this.page >= this.nums) {
			return false
		}
		this.page++;
		this.fhList(2);
	},
	onNavigationBarButtonTap() {
		uni.navigateTo({
			url: '/userPage/user/daojusm?id=' + 16
		})
	},
	onShow() {
		this.fhList()
	},
	methods: {
		quhegui() {
			uni.switchTab({
				url: '/pages/index/cabinetBox'
			})
		},
		shuoming() {
			uni.navigateTo({
				url: '/userPage/user/daojusm?id=' + 16
			})
		},
		// 重抽按钮
		submit() {
			this.tabindex = 1;
			let data = {
				order_id: this.orderidValue
			}
			this.$Request.post(this.$api.user.useBackCard, data).then(res => {
				uni.setStorageSync('cabShuaxin', 1)
				uni.navigateTo({
					url: '/orderPage/index/back?box_id=' + res.data.box_id + '&order_id=' + res
									.data.order_id + '&tenOpen=' + this.tabindex + '&box_type=' + 0 + '&aaa=' + 0
				})
				uni.showToast({
					title: res.msg,
					icon: "none"
				})
			})
		},
		radioChange(evt) {
			this.orderidValue = evt.detail.value
		},
		fhList(type) {
			let data = {
				page: this.page,
				type: 1
			}
			this.$Request.get(this.$api.user.getUsableList, data).then(res => {
				////console.log(res)
				this.nums = res.data.totalPage
				if (type == 2) {
					this.orderlist = this.orderlist.concat(res.data.list);
				} else {
					this.orderlist = res.data.list;
					this.fhnum = this.orderlist.length
				}
			});
		}

	}
}
</script>
<style scoped lang="scss">
/deep/ radio .wx-radio-input.wx-radio-input-checked {
	background: #FFAE2A;
	border: none;
}

.content {
	width: 100%;
	min-height: 100vh;
	// background: #F7F7F7;
	position: relative;
	background-image: url('https://mh.qingfentool.vip/upload/image/20230517/c010d52e6880936b5ece449360c28d29.png');
	background-size: 100% 100%;

	.bottom_box {
		position: fixed;
		bottom: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		align-items: center;
		width: 750rpx;
		height: 140rpx;
		padding: 26rpx 20rpx;
		box-shadow: 0px 3rpx 10rpx rgba(0, 0, 0, 0.16);
		background-color: #262626;


		.left_box {
			width: 60%;
			font-size: 26rpx;
			font-weight: 500;
			color: #fff;
			padding-left: 30rpx;
		}

		.right_box {
			width: 218rpx;
			height: 78rpx;
			background: linear-gradient(180deg, #FED187 0%, #FFAE2A 100%);
			border-radius: 10rpx 10rpx 10rpx 10rpx;
			opacity: 1;
			text-align: center;
			line-height: 78rpx;
			color: white;
		}
	}

	.poa {
		position: relative;
		width: 710rpx;
		height: 264rpx;
		margin: auto;
		margin-bottom: 20rpx;
		background: rgba(255, 231, 192, 0.1);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		border: 1rpx solid #FED187;

		.yuan {
			position: absolute;
			top: 50%;
			transform: translate(50%, -50%);
		}

		.big_box {
			width: 88%;
			height: 100%;
			float: right;
			display: flex;
			justify-content: space-around;
			align-items: center;

			.img_box {
				width: 178rpx;
				height: 178rpx;
				border: 1rpx solid #FED187;
				border-radius: 18rpx 18rpx 18rpx 18rpx;
				opacity: 1;
				position: relative;

				.dengji_box_tl {
					position: absolute;
					left: -10rpx;
					font-size: 29rpx;
					width: 96rpx;
					height: 52rpx;
					color: #FED187;
					font-weight: 900;
					line-height: 40rpx;
					text-align: center;

					image {
						width: 100%;
						height: 100%;
					}
				}

				image {
					width: 100%;
					height: 100%;
					border-radius: 18rpx 18rpx 18rpx 18rpx;
				}
			}

			.txt_box {
				width: 362rpx;
				height: 160rpx;
				// background-color: #fff;
				position: relative;

				.top_txt {
					position: absolute;
					top: 10rpx;
					left: 10rpx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					width: 362rpx;
					height: 34rpx;
					font-size: 24rpx;
					font-weight: 500;
					color: #fff;
					line-height: 34rpx;
				}

				.bot_txt {
					position: absolute;
					bottom: 10rpx;
					left: 10rpx;
					width: 100%;
					height: 40rpx;
					font-size: 28rpx;
					font-weight: 500;
					color: #FFAE2A;
					line-height: 40rpx;

					.bot_right_txt {
						width: 26rpx;
						height: 34rpx;
						font-size: 24rpx;
						float: right;
						padding-right: 60rpx;
						font-weight: 500;
						color: #FFAE2A;
						line-height: 34rpx;
					}
				}
			}
		}
	}



}
</style>
